package Long.Lu.Controller;



import Long.Lu.Service.LoginService;
import Long.Lu.pojo.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;

/**
 * @ClassName:
 * @description:
 * @author: yh
 * @createDate: 2020/10/24
 * @version: 1.0
 */
@Controller
public class LoginController {
    /*注入userInfoService*/
    @Autowired
    private LoginService loginService;

    /*主页面*/
    @RequestMapping("/index")
    public String login() {
        return "index";
    }

    /*登录页面*/
    @RequestMapping(value = {"", "/login"})
    public String index() {
        return "login";
    }

    @RequestMapping("/welcome")
    public String welcome() {
        return "welcome";
    }

    /*登录页面请求ajax*/
    @RequestMapping("/loginSubmit")
    @ResponseBody
    public HashMap<String, Object> loginSubmit(UserInfo userInfo, HttpServletRequest request) {
        System.out.println(userInfo);
        return loginService.loginShiro(userInfo, request);
    }

}
